<div class="problemindexholder" problemindex="B">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     B. Mister B and PR Shifts
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     Some time ago Mister B detected a strange signal from the space, which he started to study.
    </p>
    <p>
     After some transformation the signal turned out to be a permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     of length
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     or its cyclic shift. For the further investigation Mister B need some basis, that's why he decided to choose cyclic shift of this permutation which has the minimum possible deviation.
    </p>
    <p>
     Let's define the deviation of a permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     as
     <img align="middle" class="tex-formula" src="/predownloaded/be/a9/bea92b7bcc675fa677c534d8cb354a2d5a08303b.png" style="max-width: 100.0%;max-height: 100.0%;"/>
     .
    </p>
    <p>
     Find a cyclic shift of permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     with minimum possible deviation. If there are multiple solutions, print any of them.
    </p>
    <p>
     Let's denote id
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     (
     <span class="tex-span">
      0 ≤
      <i>
       k
      </i>
      &lt;
      <i>
       n
      </i>
     </span>
     ) of a cyclic shift of permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     as the number of right shifts needed to reach this shift, for example:
    </p>
    <ul>
     <li>
      <span class="tex-span">
       <i>
        k
       </i>
       = 0
      </span>
      : shift
      <span class="tex-span">
       <i>
        p
       </i>
       <sub class="lower-index">
        1
       </sub>
       ,
       <i>
        p
       </i>
       <sub class="lower-index">
        2
       </sub>
       , ...
       <i>
        p
       </i>
       <sub class="lower-index">
        <i>
         n
        </i>
       </sub>
      </span>
      ,
     </li>
     <li>
      <span class="tex-span">
       <i>
        k
       </i>
       = 1
      </span>
      : shift
      <span class="tex-span">
       <i>
        p
       </i>
       <sub class="lower-index">
        <i>
         n
        </i>
       </sub>
       ,
       <i>
        p
       </i>
       <sub class="lower-index">
        1
       </sub>
       , ...
       <i>
        p
       </i>
       <sub class="lower-index">
        <i>
         n
        </i>
        - 1
       </sub>
      </span>
      ,
     </li>
     <li>
      ...,
     </li>
     <li>
      <span class="tex-span">
       <i>
        k
       </i>
       =
       <i>
        n
       </i>
       - 1
      </span>
      : shift
      <span class="tex-span">
       <i>
        p
       </i>
       <sub class="lower-index">
        2
       </sub>
       ,
       <i>
        p
       </i>
       <sub class="lower-index">
        3
       </sub>
       , ...
       <i>
        p
       </i>
       <sub class="lower-index">
        <i>
         n
        </i>
       </sub>
       ,
       <i>
        p
       </i>
       <sub class="lower-index">
        1
       </sub>
      </span>
      .
     </li>
    </ul>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     First line contains single integer
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     (
     <span class="tex-span">
      2 ≤
      <i>
       n
      </i>
      ≤ 10
      <sup class="upper-index">
       6
      </sup>
     </span>
     ) — the length of the permutation.
    </p>
    <p>
     The second line contains
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     space-separated integers
     <span class="tex-span">
      <i>
       p
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       p
      </i>
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       p
      </i>
      <sub class="lower-index">
       <i>
        n
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       p
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤
      <i>
       n
      </i>
     </span>
     ) — the elements of the permutation. It is guaranteed that all elements are distinct.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print two integers: the minimum deviation of cyclic shifts of permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     and the id of such shift. If there are multiple solutions, print any of them.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3<br/>1 2 3<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>0 0<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3<br/>2 3 1<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>0 1<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3<br/>3 2 1<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>2 1<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In the first sample test the given permutation
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     is the identity permutation, that's why its deviation equals to
     <span class="tex-span">
      0
     </span>
     , the shift id equals to
     <span class="tex-span">
      0
     </span>
     as well.
    </p>
    <p>
     In the second sample test the deviation of
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     equals to
     <span class="tex-span">
      4
     </span>
     , the deviation of the
     <span class="tex-span">
      1
     </span>
     -st cyclic shift
     <span class="tex-span">
      (1, 2, 3)
     </span>
     equals to
     <span class="tex-span">
      0
     </span>
     , the deviation of the
     <span class="tex-span">
      2
     </span>
     -nd cyclic shift
     <span class="tex-span">
      (3, 1, 2)
     </span>
     equals to
     <span class="tex-span">
      4
     </span>
     , the optimal is the
     <span class="tex-span">
      1
     </span>
     -st cyclic shift.
    </p>
    <p>
     In the third sample test the deviation of
     <span class="tex-span">
      <i>
       p
      </i>
     </span>
     equals to
     <span class="tex-span">
      4
     </span>
     , the deviation of the
     <span class="tex-span">
      1
     </span>
     -st cyclic shift
     <span class="tex-span">
      (1, 3, 2)
     </span>
     equals to
     <span class="tex-span">
      2
     </span>
     , the deviation of the
     <span class="tex-span">
      2
     </span>
     -nd cyclic shift
     <span class="tex-span">
      (2, 1, 3)
     </span>
     also equals to
     <span class="tex-span">
      2
     </span>
     , so the optimal are both
     <span class="tex-span">
      1
     </span>
     -st and
     <span class="tex-span">
      2
     </span>
     -nd cyclic shifts.
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
